<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
			<meta name="viewport" content="width=device-width, initial-scale=1.0">
	        <link rel="stylesheet" href="css/nav.css">
	        <link rel="stylesheet" href="bootstrap-3.3.5/css/bootstrap.css">
		<title>管理员增删课程界面</title>
<link href="css/index.css" rel="stylesheet" type="text/css" /> 
<script type="text/javascript" src="js/jquery.1.4.2-min.js"></script>
<script type="text/javascript" src="js/Calculation.js"></script>
<script type="text/javascript">
$(document).ready(function () {    
	$(".allselect").click(function () {
		
		if($(this).attr("checked")){
			$(".stc_tb2 input[name=newslist]").each(function () {
				$(this).attr("checked", true);
			});
			GetCount();	
		}
		else
   		{
			$(".stc_tb2 input[name=newslist]").each(function () {
				if ($(this).attr("checked")) {
					$(this).attr("checked", false);
				} else {
					$(this).attr("checked", true);
				} 
			});
			GetCount();   
   		}		
	});
	$("#invert").click(function () {
		$(".stc_tb2 input[name=newslist]").each(function () {
			if ($(this).attr("checked")) {
				$(this).attr("checked", false);
			} else {
				$(this).attr("checked", true);
			} 
		});
		GetCount();
	});

	$("#cancel").click(function () {
		$(".stc_tb2 input[name=newslist]").each(function () {
			$(this).attr("checked", false);
		});
		GetCount();
	});
	$(".stc_tb2 input[name=newslist]").click(function () {
		if ($(this).attr("checked")) {
		} else {
		}
	});
	$(".stc_tb2 input[name=newslist]").click(function () {
		GetCount();
	});
});
</script>
</head>
	<style>
	.form-inline{
		margin-top: 50px;
		margin-left: 300px;
		font-family: "微软雅黑";
		font-size: 16px;

	}
	#exampleInputSearch{
		margin-left:400px;	
	}
	#sx{
		font-family: "微软雅黑";
		font-size:17px ;
		text-align: center;
		color: #555469;
	} 
	
	</style>
	<body>
<form class="form-inline">
  <div class="form-group">
    输入课程名称：<label class="sr-only" for="exampleInputcourse">course</label>
        <input type="text" class="form-control" id="exampleInputcourse" name="exampleInputcourse" placeholder="course">
  </div>
  
  <div class="form-group">
    输入教师姓名：<label class="sr-only" for="exampleInputteacher">teacher</label>
        <input type="text" class="form-control" id="exampleInputteacher" name="exampleInputteacher" placeholder="teacher">
  </div>
  
   <div class="form-group">
    选择上课地点：
    <select name="sk_place"> 
		<option value="0">下沙</option> 
		<option value="1">教工路</option> 
	</select> 
   </div> 
  <div class="form-group">
   选择上课时间：
    <select name="sk_time"> 
		<option value="0">星期一</option> 
		<option value="1">星期二</option> 
		<option value="2">星期三</option> 
		<option value="3">星期四</option> 
		<option value="4">星期五</option> 
	</select>  </div></br></br>
  
  <button type="submit" class="btn btn-default"  id="exampleInputSearch" onclick="Search()">Search</button>
</form>
<script type="text/javascript">
	 $(function Search(){
            $.ajax({
                type: "get",
                url: "del_increase.json",
                dataType: "json",
　　　　　　　　　       success: function(result){
                addBox(result);
                }
            });
        });

        function addBox(result){
                //result是一个集合,所以需要先遍历
	            $.each(result,function(index,obj){
	            
	                $(".tb4_td1").append(obj['course']);
	                $(".tb4_td2").append(obj['teacher']);
	                $(".tb4_td3").append(obj['place']);
	                $(".tb4_td4").append(obj['time']);
	            });
        }
 	
</script>

<hr style="height:1px;border:none;border-top:1px solid #E0E0E0" /></br> 
<div class="stc" style=" margin:auto;">
	<table cellpadding="0" cellspacing="0" class="stc_tb4">
		<tr>
	
			<td class="tb5_td1">课程名</td>
			<td class="tb5_td2">教师</td>
			<td class="tb5_td3">上课地点</td>
			<td class="tb5_td4">上课时间</td>
		</tr>
	</table>
<div id="box">
	   <table cellpadding="0" cellspacing="0" class="stc_tb0">
		<tr>
			
			<td class="tb4_td1"></td>
			<td class="tb4_td2"></td>
			<td class="tb4_td3"></td>
			<td class="tb4_td4"></td>
		</tr>
       </table>
</div>
	
	<table cellpadding="0" cellspacing="0" class="stc_tb3">
		<tr>
			<td class="tb3_td1"><button style="border: solid;border-color: #9E9E9E;border-radius: 8px;width: 110px;height: 30px;" onClick="increa()">增加</button></td>
			<td class="tb3_td2"><button style="border: solid;border-color: #9E9E9E;border-radius: 8px;width: 110px;height: 30px;" onClick="delet()">删除</button></td>	
		</tr>
	</table>
	
</div>
<script type="text/javascript">
	function increa(){
	  var inc=confirm("确定增加该课程？");
	  if(inc==true){
	  	alert("添加成功！");
	  }
	  else{
	  	alert("已取消");
	  }
	}
	
	function delet(){
	  var del=confirm("确定删除该课程？");
	  if(del==true){
	  	alert("已删除该课程！");
	  }
	   else{
	  	alert("已取消");
	  }
			}
	
</script>
   
	</body>
</html>
